package ${package}controller;


import ${package}pojo.${pojo_name_query_param};
import ${package}pojo.${pojo_name_vo};
import ${package}pojo.PageDTO;
import ${package}pojo.ResultBean;
import java.util.List;
import com.han.entity.SystemLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;


/**
* @auth Auto generate
* @time ${gen_time}
*/

@RestController
@RequestMapping(value="${requestUrlPrefix}${pojo_name ? uncap_first}")
@Api(tags = "${table_remark}")
public class ${pojo_name}Controller{


/**
* 新增
* @author Auto generate
* @date ${gen_time}
**/
@SystemLog("${table_remark} 新增")
@ApiOperation(value = "新增")
@PostMapping("/insert")
public ResultBean insert(@RequestBody ${pojo_name_vo} ${pojo_field_name_vo}){
GenericParams genericParams = new GenericParams(
"${package}services.${pojo_name_service}",
"${pojo_name_mapper}",
"1.0.0",
"insert",
new String[]{${pojo_name_vo}.class.getName()},
new Object[]{${pojo_field_name_vo}});
Object object = DubboGenericInvoker.invoke(genericParams);
return ResultHelper.parseToResultBean(object);
}

/**
* 刪除
* @author Auto generate
* @date ${gen_time}
**/
@SystemLog("${table_remark} 刪除")
@ApiOperation(value = "刪除")
@DeleteMapping("/delete/{id}")
public ResultBean delete(@PathVariable Integer id){
GenericParams genericParams = new GenericParams(
"${package}services.${pojo_name_service}",
"${pojo_name_mapper}",
"1.0.0",
"delete",
new String[]{Integer.class.getName()},
new Object[]{id});
Object object = DubboGenericInvoker.invoke(genericParams);
return ResultHelper.parseToResultBean(object);
}
/**
* 批量删除
* @author Auto generate
* @date ${gen_time}
**/
@SystemLog("${table_remark} 批量删除")
@ApiOperation(value = "批量删除")
@DeleteMapping("/batchDelete/{ids}")
public ResultBean batchDelete(@PathVariable List<Integer> ids){
    GenericParams genericParams = new GenericParams(
    "${package}services.${pojo_name_service}",
    "${pojo_name_mapper}",
    "1.0.0",
    "batchDelete",
    new String[]{List.class.getName()},
    new Object[]{ids});
    Object object = DubboGenericInvoker.invoke(genericParams);
    return ResultHelper.parseToResultBean(object);
    }
    /**
    * 编辑
    * @author Auto generate
    * @date ${gen_time}
    **/
    @SystemLog("${table_remark} 编辑")
    @ApiOperation(value = "编辑")
    @PutMapping("/update/{id}")
    public ResultBean update(@RequestBody ${pojo_name_vo} ${pojo_field_name_vo},@PathVariable Integer id){
    ${pojo_field_name_vo}.setId(id);
    GenericParams genericParams = new GenericParams(
    "${package}services.${pojo_name_service}",
    "${pojo_name_mapper}",
    "1.0.0",
    "update",
    new String[]{${pojo_name_vo}.class.getName()},
    new Object[]{${pojo_field_name_vo}});
    Object object = DubboGenericInvoker.invoke(genericParams);
    return ResultHelper.parseToResultBean(object);
    }

    /**
    * 详情查询
    * @author Auto generate
    * @date ${gen_time}
    **/
    @ApiOperation(value = "详情查询")
    @GetMapping("/details/{id}")
    public ResultBean<${pojo_name_vo}> details(@PathVariable Integer id){
        GenericParams genericParams = new GenericParams(
        "${package}services.${pojo_name_service}",
        "${pojo_name_mapper}",
        "1.0.0",
        "details",
        new String[]{Integer.class.getName()},
        new Object[]{id});
        Object object = DubboGenericInvoker.invoke(genericParams);
        return ResultHelper.parseToResultBean(object);
        }

        /**
        * 查询 分页查询
        * @author Auto generate
        * @date ${gen_time}
        **/
        @ApiOperation(value = "分页查询")
        @GetMapping("/pageList")
        public PageDTO<${pojo_name_vo}> pageList(${pojo_name_query_param} ${pojo_field_name_query_param}) {
            GenericParams genericParams = new GenericParams(
            "${package}services.${pojo_name_service}",
            "${pojo_name_mapper}",
            "1.0.0",
            "pageList",
            new String[]{${pojo_name_query_param}.class.getName()},
            new Object[]{${pojo_field_name_query_param}});
            Object object = DubboGenericInvoker.invoke(genericParams);
            return ResultHelper.parseToPageDTO(object);
        }
}
